home *** CD-ROM | disk | FTP | other *** search
- /*
- * Scan the InetUtils SMTPd Queue directory, and show us what's going in
- * where what's in the queue is going, and how long it's been there.
- *
- * Copyright 1994, Mike Meyer (mwm@contessa.phone.net)
- adapted for PostNewsSpool :jb 30-Dec-94 (James Burton burton@cs.latrobe.edu.au)
- */
-
- /* Output tuning */
- queue_len = 20
- host_len = 40
-
- /* Make sure we have the libraries */
- if ~show('Libraries', 'rexxarplib.library') then
- if ~addlib('rexxarplib.library', 0, -30) then do
- say "No rexxarplib, so we can't scan the spool!"
- exit
- end
- if ~show('Libraries', 'rexxsupport.library') then
- if ~addlib('rexxsupport.library', 0, -30) then do
- say "No rexxsupport library, so we can't scan the spool!"
- exit
- end
-
- /* Get the SMTPSPoolDir */
- /*spooldir = getuuenv('SMTPSPOOLDIR')*/
- /*spooldir = getenv('SMTPSPOOLDIR')*/
- spooldir = "UUSPOOL:news"
- if spooldir = "" then do
- say "Can't find the name of the directory to scan."
- exit
- end
- old = pragma('Directory', spooldir)
-
- /* Get a list of files in it */
- count = filelist('msg???', files)
-
- /* Now, process them */
- if count = 0 then
- say "No articles in the news queue"
- else do
- say left("Queue number", queue_len) ,
- || left("Destination newsgroup", host_len) || "Time in queue"
- say ""
- nowdays = date('Internal')
- nowminutes = time('Minutes')
- do i = 1 to count
- parse value files.i with 'msg'queue
- parse value statef(files.i) with . . . . filedays fileminutes .
- days = nowdays - filedays
- /* now days is day difference */
- minutes = nowminutes - fileminutes
- /* minutes is minute difference */
- if minutes < 0 then do
- /* then it's 1 less day than we think */
- days = days /*+*/- 1
- minutes = minutes + 1440
- end
- hours = 24 * days + minutes % 60
- minutes = minutes // 60
- destination = getdestination(files.i)
- if destination = "" then iterate
- out = left(queue, queue_len) || left(destination, host_len)
-
- select
- when hours = 0 & minutes = 0 then say out || "no time"
- when hours = 0 & minutes = 1 then say out || "1 minute"
- when hours = 0 then say out || minutes "minutes"
- when hours = 1 & minutes = 0 then say out || "1 hour"
- when hours = 1 & minutes = 1 then
- say out || "1 hour 1 minute"
- when hours = 1 then
- say out || "1 hour" minutes "minutes"
- when minutes = 0 then say out || hours "hours"
- when minutes = 1 then say out || hours "hours 1 minute"
- otherwise say out || hours "hours" minutes "minutes"
- end
- end
- end
- say ""
- exit
-
- getdestination: procedure
- parse arg file
-
- if ~open(in, file, 'Read') then return ""
- /* search for newsgroups line */
- line = ""
- do while (~eof(in)) & (left(line,11) ~= "Newsgroups:")
- line = readln(in)
- end
- call close in
- return substr(line,13)
-
- /* end of file */
-